import request from '@/config/axios'
import type { DepositRule } from './types'

export const getDepositRulesListApi = (params: any): Promise<IResponse<IResData<DepositRule>>> => {
  return request.get({ url: '/deposit-rules', params })
}

export const createDepositRulesApi = (data: Partial<DepositRule>): Promise<IResponse> => {
  return request.post({ url: '/deposit-rules', data })
}

export const updateDepositRulesApi = (
  id: string,
  data: Partial<DepositRule>
): Promise<IResponse> => {
  return request.put({ url: `/deposit-rules/id/${id}`, data })
}

export const getDepositRulesDetailApi = (id: string): Promise<IResponse<DepositRule>> => {
  return request.get({ url: `/deposit-rules/id/${id}` })
}

export const delDepositRulesListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.delete({ url: `/deposit-rules/id/${ids[0]}` })
}
